import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// get-请求
export function getApiConfigParams(url,data) {
    return request({
        url: url,
        method: 'get',
        params: data
    })
}

export function getApiConfig(url,data) {
    return request({
        url: url + parseStrEmpty(data),
        method: 'get'
    })
}

export function getApi(url,data) {
    return request({
        url: url + data,
        method: 'get'
    })
}

// post-请求
export function postApiConfig(url,data){
    return request({
        url: url,
        data: data,
        method: 'post',
    })
}

// delete-请求
export function deleteApiConfig(url,data){
    return request({
        url: url + data,
        method: 'delete'
    })
}

export function deleteApiConfigParams(url,data){
    return request({
        url: url,
        method: 'delete',
        params: data
    })
}

// put-请求
export function putApiConfig(url,data){
    return request({
        url: url,
        data: data,
        method: 'put',
    })
}

// patch-请求
export function patchApiConfig(url,id,data){
    return request({
        url: url + id,
        data: data,
        method: 'patch',
    })
}

// excel 下载
export function getApiExcel(url,data) {
    return request({
        url: url + parseStrEmpty(data),
        method: 'get',
        responseType: 'blob',
    })
}

export function getApiExcelParams(url,data) {
    return request({
        url: url,
        method: 'get',
        params: data,
        responseType: 'blob',
    })
}

export function postApiExcel(url,data){
    return request({
        url: url,
        method: 'post',
        data: data,
        responseType:'blob',
    })
}
